import { BaseGame } from "@/base/baseGame";
import { world } from "@minecraft/server";
import { Dimensions } from "@sapi-game/constants";
import { Game, initSAPIGame } from "@sapi-game/main";
import { logLevel } from "@sapi-game/utils";
import { Hub } from "./func";

initSAPIGame({
    logLevel: logLevel.debug,
    debugMode: false,
    onEnd: onEnd,
    hub: Hub,
    onJoin(p) {
        if (!Game.playerManager.isPlayerAllocated(p.id)) {
        }
    },
});

function onEnd() {
    Dimensions.Overworld.runCommand("function gameEnd");
}

world.afterEvents.worldLoad.subscribe(() => {
    Game.manager.startGame(BaseGame);
});
